package com.example.demo.rabbitmq.delay;

import java.util.concurrent.ConcurrentHashMap;

/**
 * @author Smile to life
 */

public enum DelayTypeEnum {

    /**
     * 延时10秒
     */
    DELAY_10s(1, "延时10秒"),
    /**
     * 延时60秒
     */
    DELAY_60s(2, "延时60秒");

    int delayType;
    String delayValue;

    DelayTypeEnum(int delayType, String delayValue) {
        this.delayType = delayType;
        this.delayValue = delayValue;
    }

    private static final ConcurrentHashMap hashMap = new ConcurrentHashMap<>(2);

    static {
        hashMap.put(1, DELAY_10s);
        hashMap.put(2, DELAY_60s);
    }

    public static DelayTypeEnum getDelayTypeEnumByValue(int delayType) {
        DelayTypeEnum delayTypeEnum = (DelayTypeEnum) hashMap.get(delayType);
        return delayTypeEnum;
    }

}
